<template>
    <div class="container">
        <span>{{ title }}</span>
        <ul>
            <li v-for="hotNew in hotNews" :key="hotNew.no">
                {{ hotNew.title }}
            </li>
        </ul>
    </div>
</template>

<script setup>
    import { inject } from 'vue';
    // 后代组件通过inject获取数据
    let title = inject('title')
    let hotNews = inject('content')
</script>
<style scoped>
    .container {
        color: purple;
    }
</style>